package com.xcode.xandrdb.Catch;

import java.util.LinkedList;
import java.util.List;

import com.xcode.xandrdb.sqlite.SqliteHelper;

public class TransationCatch
{
	private static TransationCatch bashCatch = new TransationCatch();
	private List<String> list = new LinkedList<String>();
	
	
	public static TransationCatch getInstance()
	{
		return bashCatch;
	}

	public synchronized void add(String sql)
	{
		list.add(sql);
	}
	public synchronized void commit()
	{
		List<String> tmp = new LinkedList<String>(list);
		
		list.clear();
		SqliteHelper.getInstance().bashExecSQL(tmp);
		tmp.clear();
	}
}
